<template>
  <el-form ref="form" label-position="right" :model="currentRow" :rules="rules" label-suffix="："
           label-width="100px">
    <el-card shadow="always">
      <p class="info-title">
        排查复核
      </p>
      <!--复核展示-->
      <div style="width: 250px">
        <el-form-item label="状态" prop="dangerLevel">
          <el-select v-model="currentRow.checkStatus">
            <el-option
              v-for="item in selectCheckStatusList"
              :key="item.code"
              :label="item.name"
              :disabled="item.disable"
              :value="item.code">
            </el-option>
          </el-select>
        </el-form-item>
      </div>
      <div v-if="currentRow.checkStatus === 3 && model === 'major-jianli'">
        <el-form-item label="整改截止日期" prop="investigateTime">
          <el-date-picker
            v-model="currentRow.rectificationTime"
            type="date"
            placeholder="选择整改截止日期">
          </el-date-picker>
        </el-form-item>

        <div class="geology-children">
          整改建议
        </div>
        <el-form-item>
          <el-input v-model="currentRow.advice" clearable type="textarea" :rows="4"
                    placeholder="输入整改建议"></el-input>
        </el-form-item>
      </div>


      <div v-if="currentRow.checkStatus === 1">
        <div class="geology-children">
          驳回理由
        </div>
        <el-form-item>
          <el-input v-model="currentRow.reason" clearable type="textarea" :rows="4"
                    placeholder="填写驳回理由"></el-input>
        </el-form-item>
      </div>


    </el-card>

  </el-form>
</template>
<script>
import ItemMixins from "./item.mixins";

export default {
  props: ['value', 'model'],
  mixins: [ItemMixins],
  data() {
    return {
      //正常和一般隐患
      checkStatusList1: [
        {code: 1, name: "驳回"},
        {code: 2, name: "符合"},//无整改要求
        {code: 3, name: "待整改"},
      ],
      //重大隐患(监理单位)
      cancelStatusList2: [
        {code: 1, name: "驳回"},
        {code: 9, name: "符合"},//监理已复核
      ],
      //重大隐患(建设单位)
      cancelStatusList3: [
        {code: 1, name: "驳回"},
        {code: 3, name: "符合"},//待整改
      ],
    }
  },
  computed: {
    selectCheckStatusList() {
      if (this.currentRow.dangerLevelName === '一般隐患') {
        return this.checkStatusList1
      }
      switch (this.model) {
        case 'major-jianli': //复核重大隐患-监理
          return this.cancelStatusList2
        case 'major-jianshe': //复核重大隐患-建设
          return this.cancelStatusList3
        default:
          return this.checkStatusList1
      }

    },
    currentRow: {
      get() {
        return this.value
      },
      set(value) {
        this.$emit('input', value)
      }
    }
  },
  methods: {
    // 内部表单校验
    _validatorForm() {
      return new Promise((resolve) => {
        this.$refs.form.validate((valid) => {
          valid && resolve()
        })
      })
    }
  },
  mounted() {
  },
  created() {
  },
  activated() {
    this.$nextTick(() =>
      this.$refs.form.clearValidate()
    )
  }
}
</script>

<style lang="less">
  .el-date-editor.el-input, .el-date-editor.el-input__inner {
    width: 298px !important;
  }

  .geology-children {
    font-size: 15px;
    border-bottom: 1px solid;
    margin-bottom: 20px;
    margin-top: 20px;
    margin-left: 20px;
  }

  .info-title {
    font-size: 18px;
    color: #1990FE;
    font-weight: 600;
    margin-bottom: 10px;
  }

  .el-card {
    margin-bottom: 20px;
  }

  .form_compact {
    display: flex;

    & /deep/ .el-input input {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }

    & /deep/ .el-button {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
  }

  .el-button {
    padding-right: 40px;
  }

  .el-form-item__label {
    /*padding: 0px;*/
  }

  input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
  }
</style>
